]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
workspace: Add smooth scrolling support to zoom windows
authorJasper St. Pierre <jstpierre@mecheye.net>
Sun, 4 Nov 2012 15:55:37 +0000 (10:55 -0500)
committerJasper St. Pierre <jstpierre@mecheye.net>
Thu, 20 Dec 2012 13:40:05 +0000 (08:40 -0500)
https://bugzilla.gnome.org/show_bug.cgi?id=687573

js/ui/workspace.js

index 25877b20b1b040f9665eb58c4838e27804df5682..c026da8c4b280b486b4c1fda4c412857588f13f2 100644 (file)
@@ -260,23 +260,37 @@ const WindowClone = new Lang.Class({
 
     _onScroll : function (actor, event) {
         let direction = event.get_scroll_direction();
-        if (direction == Clutter.ScrollDirection.UP) {
+        let delta;
+
+        if (event.is_pointer_emulated())
+            return;
+
+        if (direction == Clutter.ScrollDirection.DOWN) {
+            delta = -SCROLL_SCALE_AMOUNT;
+        } else if (direction == Clutter.ScrollDirection.UP) {
+            delta = +SCROLL_SCALE_AMOUNT;
+        } else if (direction == Clutter.ScrollDirection.SMOOTH) {
+            let [dx, dy] = event.get_scroll_delta();
+            delta = -dy * 10;
+        }
+
+        if (delta > 0) {
             if (this._zoomStep == undefined)
                 this._zoomStart();
             if (this._zoomStep < 100) {
-                this._zoomStep += SCROLL_SCALE_AMOUNT;
+                this._zoomStep += delta;
+                this._zoomStep = Math.min(100, this._zoomStep);
                 this._zoomUpdate();
             }
-        } else if (direction == Clutter.ScrollDirection.DOWN) {
+        } else if (delta < 0) {
             if (this._zoomStep > 0) {
-                this._zoomStep -= SCROLL_SCALE_AMOUNT;
+                this._zoomStep += delta;
                 this._zoomStep = Math.max(0, this._zoomStep);
                 this._zoomUpdate();
             }
             if (this._zoomStep <= 0.0)
                 this._zoomEnd();
         }
-
     },
 
     _zoomUpdate : function () {